<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
		
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./assets/scripts/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		
		<script type="text/javascript" src="./assets/scripts/search.js"></script>
		
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.btn_regist').click(function(){
				if( confirm('登録してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			
			$('.btn_update').click(function(){
				if( confirm('更新してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			$('.btn_return').click(function(){
				location.href = "majareks_index.php?hist=2";
			});
		});
		
		function setSS( valcd, valnm ) {
			document.fm.shop_cd.value = valcd;
			document.fm.shop_name.value = valnm;			
			$('#dialog').dialog("close");
		}
	
		function li_add(objID,inID, inVal) {
			if (checkNames(inID)) {
				var strHtml = "<li id='a" + inID +"' class='item_li'> <a href='#'  style='color:red' class='li_del' >X</a>&nbsp;&nbsp;"+ inID + "&nbsp;&nbsp;" + inVal;
				strHtml = strHtml + "<input type='hidden' value='" + inID + "' name ='" + gMutiObj +"_cd[]'>";
				strHtml = strHtml + "<input type='hidden' value='" + inVal + "' name ='" + gMutiObj +"_name[]'>";
				strHtml = strHtml + "</li>";
				$("#" + objID +"_ul").append(strHtml);

			}
		}
		function setS( val ) {
			document.fm.zone_name.value = val;
			$('#dialog').dialog("close");
		}
		</script>
		
	</head>
	<body id="">
{{ $menu }}
{{ $logout }}
		<div id="container"><div class="wrapper">
			<h2>AJAREKSマスター管理</h2>
			<ul class="submenu clearfix">
				<li><a href="majareks_index.php">AJAREKS情報一覧</a></li>
				<li>AJAREKS情報登録/修正</li>
				<li><a href="majareks_import.php">CSV更新</a></li>
			</ul>
			<h3>AJAREKS情報{{ if $forms.id == '' }}登録{{ else }}更新{{ /if }}{{ if $phase == 'complete' }}完了{{ /if }}</h3>
{{ if $phase == 'input' }}
			<p class="message">内容を確認し、{{ if $forms.id == '' }}登録{{ else }}更新{{ /if }}ボタンをクリックしてください。</p>
			<form name="fm" action="majareks_form.php" method="post">
				<table class="formTable">
					<tbody>
{{ if $forms.id != '' }}
						<tr>
							<th>更新日</th>
							<td>
								{{ $forms.u_time|date_format:"%Y/%m/%d %H:%M" }}<input type="hidden" name="u_time" value="{{ $forms.u_time }}" />
							</td>
						</tr>
						<tr>
							<th>更新者</th>
							<td>
								{{ $forms.m_user_name }}<input type="hidden" name="m_user_name" value="{{ $forms.m_user_name }}" />
							</td>
						</tr>

						<tr>
							<th>担当者</th>
							<td>
								{{ $forms.userid|escape }}&nbsp;&nbsp;{{ $forms.user_name|escape }}
								<input type="hidden" name="user_name"  value="{{ $forms.user_name|escape }}" />
								<input type="hidden" name="userid"    value="{{ $forms.userid|escape }}" />
							</td>
						</tr>
						<tr>
							<th>区分</th>
							<td>
								{{ $forms.area_zone }}<input type="hidden" name="area_zone"    value="{{ $forms.area_zone|escape }}" />
								<input type="hidden" name="auth"    value="{{ $forms.auth|escape }}" />
							</td>
						</tr>
{{else}}
						<tr>
							<th>担当者</th>
							<td>
								<input type="text" name="user_name" class="text" value="左0" readonly="readonly" />
								<input type="hidden" name="userid"  value="10" />
								<button type="button" id="shop" class="btn_search" rel="shop"><span>参照</span></button>
								{{ $err.shop_cd }} 
							</td>
						</tr>
{{ /if }}
<!--
{{ if $forms.auth == '3' }}
						<tr>
							<th><span>※</span>ゾーン</th>
							<td>
								
								<input type="text" name="zone_name" class="text" value="{{ $forms.zone_name|escape }}"  maxlangth="100" />{{ $err.zone_cd }}
								<button type="button" id="zone" class="btn_search" rel="zone"><span>参照</span></button>
							</td>
						</tr>
{{ /if }}-->
						<tr>
							<th><span>※</span>店舗</th>
							<td>
							<button type="button" id="shop" class="btn_search_muti" ><span>店舗追加</span></button><br>
								<ul id="shop_ul" class="item_ul">	
{{ foreach from=$forms.mutirow key=k item=v name="member" }}
									<li  class='item_li'>
									 <a href='#' class='li_del'  >X</a>&nbsp;&nbsp;{{ $v.shop_cd }}&nbsp;&nbsp;{{ $v.shop_name }}
									<input type='hidden' value='{{ $v.shop_cd }}' name ='shop_cd[]'>
									<input type='hidden' value='{{ $v.shop_name }}' name ='shop_name[]'>
									</li>
{{ /foreach }}
								</ul>
								 {{ $err.shop_cd }}
							</td>
						</tr>
<!-- 
{{ if $forms.id != '' }}
						<tr>
							<th>非表示設定</th>
							<td style = "vertical-align:middle">
 {{ if $forms.disp_ng == '1' }}
								<label><input class="chkinput" type="checkbox" name="disp_ng" value="1" checked /> 非表示にする</label>
 {{ else }}
								<label><input class="chkinput" type="checkbox" name="disp_ng" value="1"  /> 非表示にする</label>
 {{ /if }}
							</td>
						</tr>
 {{ /if }}
 -->
					</tbody>
				</table>
				<p class="button">
{{ if $forms.id != '' }}
					<button type="button" class="btn_return" class="submit"><span>戻る</span></button>
					<button type="button" class="btn_update" class="submit"><span>更新</span></button>
{{ else }}
					<button type="button" class="btn_regist" class="submit"><span>登録</span></button>
{{ /if }}
				</p>
				<input type="hidden" name="id" value="{{ $forms.id }}" />
				<input type="hidden" name="mode" value="" />
			</form>

<div id="dialog" >
</div>
 <div id="dialogmuti" >
</div>
 
{{ /if }}

{{ if $phase == 'complete' }}
			<p class="message">{{ $message }}</p>
			<ul>
{{ if $forms.id != '' }}
				<li>>> <a href="majareks_index.php?hist=2">一覧ページに戻る</a></li>
{{ else }}
				<li>>> <a href="majareks_index.php">一覧ページに戻る</a></li>
{{ /if }}
{{ if $forms.id != '' }}
				<li>>> <a href="majareks_form.php?id={{ $forms.id }}">更新</a></li>
{{ /if }}
			</ul>
{{ /if }}

		</div></div>
		{{ $footer }}
	</body>
</html>